package objects
{
	import core.Assets;
	
	import flash.media.Video;
	
	import starling.display.Image;
	import starling.display.Shape;
	import starling.display.Sprite;
	import starling.events.Event;
	
	public class Bullet extends Sprite
	{
		private var _bulletImage:Image;
		public var displayBounds:Shape;
		
		public function Bullet()
		{
			super();
						
			this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
		}
		
		public function destroy():void
		{
			this.removeChild(_bulletImage);
			_bulletImage.dispose();
		}
		
		private function onAddedToStage(e:Event):void
		{
			this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
			
			_bulletImage = new Image(Assets.atlasTexture.getTexture("player-bullet"));
			this.addChild(_bulletImage);
			this.pivotX = this.width * 0.5;
			this.pivotY = this.height * 0.5;
			
			/*displayBounds = new Shape();
			displayBounds.graphics.lineStyle(1, 0xff);
			displayBounds.graphics.drawRect(this.bounds.x, this.bounds.y, this.bounds.width, this.bounds.height);
			displayBounds.graphics.endFill();
			this.addChild(displayBounds);*/
		}
	}
}



































